package com.vr.core.system.system.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.*;

import java.util.Map;

@Mapper
public interface CommonDaoMapper  {

    @Select("SELECT * FROM ${tableName} ")
    Page<Map<String, Object>> commonPageList(@Param("tableName") String tableName, @Param("page") Page page,@Param("condition") QueryWrapper queryWrapper);


    @Insert("INSERT INTO  ${tableName} (${fields}) VALUES (${values})")
    int commonSave(@Param("tableName") String tableName, @Param("fields") String fields, @Param("values")String values);


    @Update("UPDATE ${tableName}  SET ${setSql} WHERE id=#{id} ")
    int commonUpdate(@Param("tableName") String tableName, @Param("setSql") String setSql, @Param("id")String id);

    @Delete("DELETE from ${tableName} WHERE id = #{id}")
    int commonDelete(@Param("tableName") String tableName,@Param("id") String id);
}
